package com.lihua.imgs.upload.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @author lihua
 * @date 2024/4/17 11:28
 **/
@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    String filePath = System.getProperties().getProperty("user.home")+"/profile/";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /**
         * 本地文件上传路径
         * 将请求/profile/** 重定向到文件
         * */
        registry.addResourceHandler("/profile/**").addResourceLocations("file:" + filePath);

    }

}